<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <style type="text/css">
        html,
        body {
            height: 100%;
        }

        .wrap {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
        }

        header {
            height: 44px;
            width: 100%;
            text-align: center;
            background-color: #81a9c3;
            color: #fff;
            line-height: 44px;
            font-size: 20px;
        }

        .flex-1 {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            margin-top: 50px;
        }

        footer {
            height: 30px;
            width: 100%;
            background-color: #81a9c3;
            color: white;
            line-height: 30px;
            text-align: center;
        }
    </style>
</head>

<body class="wrap">
    <section class="flex-1">
    </section>
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
    apiready = function() {
        api.openFrame({
            name: 'main',
            url: 'http://c.earnw.cn/',
            bounces: true,
            rect: {
                w: 'auto'
            }
        });
    };
    // 好友分享
    function wxSession(a,b,c,d){
      var wx = api.require('wx');
      wx.isInstalled(function(ret, err){
          if(ret.installed){
            wx.shareWebpage({
              apiKey: 'wxb21fed80793121a3',
              scene : 'session',
              title: a,
              description:b,
              thumb:c,
              contentUrl:d,
            }, function(ret, err) {
              if (ret.status) {
                    alert('分享成功');
                } else {
                    alert(err.code);
                }
            });
          }else{
              alert('当前设备未安装微信客户端');
          }
      });
    }
    // 朋友圈分享
    function wxTimeline(a,b,c,d){
      var wx = api.require('wx');
      wx.isInstalled(function(ret, err){
          if(ret.installed){
            wx.shareWebpage({
              apiKey: 'wxb21fed80793121a3',
              scene : 'timeline',
              title: a,
              description:b,
              thumb:c,
              contentUrl:d,
            }, function(ret, err) {
              if (ret.status) {
                    alert('分享成功');
                } else {
                    alert(err.code);
                }
            });
          }else{
              alert('当前设备未安装微信客户端');
          }
      });
    }
</script>

</html>
